package org.comiee.airwalker.item;


import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import static org.comiee.airwalker.AirWalker.MODID;
import static org.comiee.airwalker.block.ModBlocks.AIR_GLASS_BLOCK;

public final class ModItems {
    public static final DeferredRegister<Item> ITEMS =
            DeferredRegister.create(ForgeRegistries.ITEMS, MODID);

    // 把 AIR_GLASS_BLOCK 自动包装成 BlockItem 并注册
    public static final RegistryObject<Item> AIR_GLASS_ITEM =
            ModItems.registerBlock(AIR_GLASS_BLOCK);

    private static RegistryObject<Item> registerBlock(RegistryObject<Block> block) {
        return ITEMS.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties()));
    }
}